package com.banggood.common.filter;

import com.banggood.pps.commons.util.DisableCacheUtils;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter(urlPatterns = { "/", "*.html"})
public class DisableCacheFilter implements Filter {

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {
	}

	@Override
	public void destroy() {
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		DisableCacheUtils.disableCache((HttpServletRequest) request, (HttpServletResponse) response);
		chain.doFilter(request, response);
	}

}
